import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayPolicyVO, PayPolicyForm, PayPolicyQuery } from '@/api/system/PayPolicy/types';

/**
 * 查询风控策略列表
 * @param query
 * @returns {*}
 */

export const listPayPolicy = (query?: PayPolicyQuery): AxiosPromise<PayPolicyVO[]> => {
  return request({
    url: '/system/PayPolicy/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询风控策略详细
 * @param policyId
 */
export const getPayPolicy = (policyId: string | number): AxiosPromise<PayPolicyVO> => {
  return request({
    url: '/system/PayPolicy/' + policyId,
    method: 'get'
  });
};

/**
 * 新增风控策略
 * @param data
 */
export const addPayPolicy = (data: PayPolicyForm) => {
  return request({
    url: '/system/PayPolicy',
    method: 'post',
    data: data
  });
};

/**
 * 修改风控策略
 * @param data
 */
export const updatePayPolicy = (data: PayPolicyForm) => {
  return request({
    url: '/system/PayPolicy',
    method: 'put',
    data: data
  });
};

/**
 * 删除风控策略
 * @param policyId
 */
export const delPayPolicy = (policyId: string | number | Array<string | number>) => {
  return request({
    url: '/system/PayPolicy/' + policyId,
    method: 'delete'
  });
};
